package IC.Symbols;

import IC.Types.ClassType;
import IC.Types.MethodType;
import IC.Types.Type;

public class Symbol {
	private String id;
	private Type type;
	private Kind kind;
	private int order;

	public Symbol(String symId, Kind symKind, Type symType, int order){
		this.id = symId;
		this.kind = symKind;
		this.type = symType;
		this.order = order;
	}
	
	public int getOrder(){
		return order;
	}
	
	public Type getType(){
		return type;
	}

	public Kind getKind(){
		return kind;
	}

	public String toString(){
		if (type instanceof ClassType){
			if (kind == Kind.CLASS) {
				return kind + ": " + id;
			} else { 
				return kind + ": " + ((ClassType)type).getName() + " " + id;	
			}
		}
		else if (type instanceof MethodType){
			return kind + ": " + id + " " + type;			
		}
		else{
			return kind + ": " + type + " " + id;
		}
	}
}
